<?php
/**
 * Created by PhpStorm.
 * User: Kyle
 * Date: 2019/7/17
 * Time: 15:17
 */

namespace app\common\model;


use think\Model;

class Config extends Model
{
    protected $pk = 'id';

    public function getWechatConfig(){
        $data = self::where(['config_key'=>array(
            'wechat_token','wechat_appid','wechat_secret','wechat_thumb_media_id','wechat_img_url'
        )])->select()->toArray();
        if($data){
            $data = array_column($data,null,'config_key');
        }
        $new = array();
        if($data){
            foreach ($data as $k=>$v){
                $new[$k] = $v['config_value'];
            }
        }
        return $new;
    }
}